/**
 * fishing-sessions apis
 */
import { post, get, put, del } from "../utils/request";

/**
 * fetch fishing session list
 * @returns
 */
export async function fetchSessionList(spotId, date) {
  const res = await post(`/fishing-session/spot/${spotId}/by-date`, {
    date,
  });
  return res.data;
}

/**
 * create fishing session
 * @param {Object} data - 放钓数据
 * @returns
 */
export async function createFishingSession(data) {
  const res = await post("/fishing-session", data);
  return res;
}

/**
 * update fishing session
 * @param {string} id - 放钓ID
 * @param {Object} data - 放钓数据
 * @returns
 */
export async function updateFishingSession(id, data) {
  const res = await put(`/fishing-session/${id}`, data);
  return res;
}

/**
 * get 放钓下一个日期
 * @param {string} spotId - 钓场ID
 * @returns
 */
export async function getSpotNextDate(spotId) {
  const res = await get(`/fishing-session/spot/${spotId}/next-date`);
  return res;
}
